# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.BeyondCorp.V1.Model.CloudSecurityZerotrustApplinkAppConnectorProtoConnectionConfig do
  @moduledoc """
  ConnectionConfig represents a Connection Configuration object.

  ## Attributes

  *   `applicationEndpoint` (*type:* `String.t`, *default:* `nil`) - application_endpoint is the endpoint of the application the form of host:port. For example, "localhost:80".
  *   `applicationName` (*type:* `String.t`, *default:* `nil`) - application_name represents the given name of the application the connection is connecting with.
  *   `gateway` (*type:* `list(GoogleApi.BeyondCorp.V1.Model.CloudSecurityZerotrustApplinkAppConnectorProtoGateway.t)`, *default:* `nil`) - gateway lists all instances running a gateway in GCP. They all connect to a connector on the host.
  *   `name` (*type:* `String.t`, *default:* `nil`) - name is the unique ID for each connection. TODO(b/190732451) returns connection name from user-specified name in config. Now, name = ${application_name}:${application_endpoint}
  *   `project` (*type:* `String.t`, *default:* `nil`) - project represents the consumer project the connection belongs to.
  *   `tunnelsPerGateway` (*type:* `integer()`, *default:* `nil`) - tunnels_per_gateway reflects the number of tunnels between a connector and a gateway.
  *   `userPort` (*type:* `integer()`, *default:* `nil`) - user_port specifies the reserved port on gateways for user connections.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :applicationEndpoint => String.t() | nil,
          :applicationName => String.t() | nil,
          :gateway =>
            list(
              GoogleApi.BeyondCorp.V1.Model.CloudSecurityZerotrustApplinkAppConnectorProtoGateway.t()
            )
            | nil,
          :name => String.t() | nil,
          :project => String.t() | nil,
          :tunnelsPerGateway => integer() | nil,
          :userPort => integer() | nil
        }

  field(:applicationEndpoint)
  field(:applicationName)

  field(:gateway,
    as: GoogleApi.BeyondCorp.V1.Model.CloudSecurityZerotrustApplinkAppConnectorProtoGateway,
    type: :list
  )

  field(:name)
  field(:project)
  field(:tunnelsPerGateway)
  field(:userPort)
end

defimpl Poison.Decoder,
  for:
    GoogleApi.BeyondCorp.V1.Model.CloudSecurityZerotrustApplinkAppConnectorProtoConnectionConfig do
  def decode(value, options) do
    GoogleApi.BeyondCorp.V1.Model.CloudSecurityZerotrustApplinkAppConnectorProtoConnectionConfig.decode(
      value,
      options
    )
  end
end

defimpl Poison.Encoder,
  for:
    GoogleApi.BeyondCorp.V1.Model.CloudSecurityZerotrustApplinkAppConnectorProtoConnectionConfig do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
